<template>
  <div class="Me">
    <img class="bg" src="@/assets/images/Me/TopBg.png" alt />
    <!-- <h1>欢迎登录软考练习软件</h1> -->
    <div class="user">
      <img src="@/assets/images/Me/Avatar.png" alt />
      <div class="username">{{username}}</div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      listData: [
        [
          { title: '个人资料' },
          { title: 'VIP会员' },
          { title: '我的错题', border: true }
          // { title: '我的收藏', border: true }
        ],
        [
          { title: '切换科目' },
          { title: '帮助与反馈' },
          { title: '清理缓存', border: true }
        ],
        [
          { title: '成绩查询' },
          { title: '关于版本' },
          { title: '将App，推荐给您的好友吧！', border: true }
        ]
      ],
      username: ''
    }
  },
  created () {
    // this.ontest()
    this.getUser()
  },
  methods: {
    // async ontest () {
    //   this.$http.get('/choiceQuestion').then(res => {
    //     console.log(res)
    //   })
    // },
    async getUser () {
      this.$http.get('/userinfo').then(res => {
        console.log(res.data[0].username)
        this.username = res.data[0].username
      })
    }
  }
}
</script>

<style lang="less" scoped>
.Me {
  position: relative;
  text-align: center;
  .username {
    font-size: 20px;
  }
  h1 {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  .bg {
    width: 100%;
  }
  .user {
    width: 100%;
    height: 100%;
    // border: 1px solid #000;
    text-align: center;
    position: absolute;
    top: 40%;
    // left: 50%;
    // transform: translate(-50%, -50%);
  }
}
</style>
